// common resetting
#eh-syringe-popup-root {
    text-align: initial;
    font-size: initial;
    line-height: initial;
    input,
    table,
    th,
    td {
        background: inherit;
        color: inherit;
    }

    input {
        border: none;
        padding: 0;
        margin: 0;
    }

    input[type='radio'],
    input[type='checkbox'] {
        position: initial;
        top: initial;
    }
    p {
        margin: 0.8em 0;
    }
    a {
        background: rgba(0, 0, 0, 0);
        transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1) 0s;
        text-decoration: none;
    }
}

// theme
.theme(@background, @foreground, @shadow, @accent) {
    @soft-accent: softlight(@accent, @background);
    &,
    .panel {
        background: @background;
        color: @foreground;
    }

    #info {
        color: @accent;
    }
    .hasNew {
        color: softlight(#aa575e, @foreground);
    }
    a {
        color: @accent;
        &:hover {
            color: softlight(@accent, @foreground);
        }
        &:active {
            color: softlight(@accent, @background);
        }
        &.minor {
            color: #a5a3a6;
            &:hover {
                color: #d2cdd4;
            }
            &:active {
                color: #838185;
            }
        }
    }
    .logo svg {
        @sa: lighten(average(@accent, @background), 10%);
        [fill-bg] {
            fill: @background;
        }
        [fill-accent] {
            fill: @accent;
        }
        [fill-sa] {
            fill: @sa;
        }
        [stroke-bg] {
            stroke: @background;
        }
        [stroke-accent] {
            stroke: @accent;
        }
        [stroke-sa] {
            stroke: @sa;
        }
    }

    .action {
        background: @background;
        color: @accent;

        &.primary {
            background: @accent;
            color: @background;
        }
        &.primary:hover {
            background: softlight(@accent, @foreground);
        }
        &.primary:active {
            background: softlight(@accent, @background);
        }
    }

    #settingForm {
        .checkbox-item svg path {
            stroke: @accent;
        }

        input[type='checkbox'] {
            border: solid 2px #a09da6;
            &:checked {
                border: solid 2px @accent;
            }
        }

        input[type='range'] {
            &::-webkit-slider-runnable-track {
                border: 1px @soft-accent solid;
            }
            &::-moz-range-track {
                border: 1px @soft-accent solid;
            }
            &::-webkit-slider-thumb {
                background: @background;
                border: solid 2px @accent;
            }
            &::-moz-range-thumb {
                background: @background;
                border: solid 2px @accent;
            }
            &:focus::-webkit-slider-thumb {
                border: solid 2px @accent;
                box-shadow: 0 0 7px @shadow;
            }
            &:focus::-moz-range-thumb {
                border: solid 2px @accent;
                box-shadow: 0 0 7px @shadow;
            }
            &:active::-webkit-slider-thumb {
                border: solid 2px @accent;
                background: overlay(@background, @background);
                box-shadow: 0 0 7px 1px @shadow;
            }
            &:active::-moz-range-thumb {
                border: solid 2px @accent;
                background: overlay(@background, @background);
                box-shadow: 0 0 7px 1px @shadow;
            }
        }
    }
}
#eh-syringe-popup-root {
    @background: rgb(240, 240, 240);
    @foreground: #111;
    @shadow: rgba(0, 0, 0, 0.2);
    @accent: #8041a6;
    .theme(@background, @foreground, @shadow, @accent);
}
body.ex #eh-syringe-popup-root {
    @background: rgb(49, 49, 49);
    @foreground: #eee;
    @shadow: rgba(0, 0, 0, 0.2);
    @accent: #ce90f1;
    .theme(@background, @foreground, @shadow, @accent);
}

#eh-syringe-popup-root {
    overflow: hidden;
    white-space: nowrap;
    font-family: sans-serif;
    font-size: 12pt;
    user-select: none;
    padding: 1px;
    max-width: 400px;
    min-width: 240px;
    position: relative;

    .hidden {
        visibility: hidden;
        display: none;
    }

    .panel {
        margin: 0 auto;
        display: flex;
        flex-direction: column;

        .header {
            margin: 16px;
            line-height: 1;
            //font-size: 16px;
            display: flex;
            > .cushion {
                flex: auto;
            }
            span {
                color: #a5a3a6;
            }
        }

        .content {
            margin: 0 16px;
            flex: auto;
            overflow: visible;
        }

        .action {
            display: block;
            line-height: 36px;
            font-size: 16px;
            margin: 16px;
            box-sizing: border-box;
            position: relative;
            user-select: none;
            cursor: pointer;
            outline: 0;
            -webkit-tap-highlight-color: transparent;
            white-space: nowrap;
            text-decoration: none;
            text-align: center;
            min-width: 64px;
            padding: 0 16px;
            border-radius: 4px;
            overflow: visible;
            transform: translate3d(0, 0, 0);
            border: 1px #ddd solid;
            transition: background 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);

            &.primary {
                border: none;
                box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14),
                    0 1px 5px 0 rgba(0, 0, 0, 0.12);
            }
            &.primary:active {
                border: none;
                box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14),
                    0 3px 14px 2px rgba(0, 0, 0, 0.12);
            }
            &:disabled {
                opacity: 0.6;
            }
            &:focus {
                border: 1px #888 solid;
            }
        }
    }

    #mainPanel {
        transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1), transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
        transform: scale(1);
        &.hide {
            transform: scale(0.9);
        }
    }

    .logo-box {
        overflow: hidden;
        position: relative;
        margin: -16px;
        pointer-events: none;
    }
    .logo {
        text-align: center;
        margin: 20px 0;
        transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
        transform: scale(1) rotate(-45deg);
        #Syringe {
            pointer-events: all;
        }
        #Enema {
            opacity: 0;
            transform-origin: 61px 86px;
        }
        #Enema2 {
            opacity: 1;
        }
        #Enema,
        #Enema2,
        #PushRod {
            transition: width 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 280ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
        }
        &.prominent {
            #Enema2 {
                opacity: 0;
            }
            #Enema {
                opacity: 1;
            }
            transform: scale(1.6) rotate(0deg);
            &.injection {
                transform: scale(1.6) rotate(0deg) translate(-10px, 0);
                #Enema,
                #Enema2,
                #PushRod {
                    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1), transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
                }
            }
        }
    }

    #info {
        position: absolute;
        bottom: 30px;
        left: 0;
        right: 0;
        height: 24px;
        line-height: 24px;
        text-align: center;
        font-size: 16px;
    }

    .monospace {
        font-family: Menlo, Consolas, 'Source Code Pro', Inconsolata, Monaco, 'Courier New', monospace;
    }
    table {
        font-size: 14px;
    }

    #settingPanel {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        right: 0;
        pointer-events: none;
        opacity: 0;
        transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1), transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
        transform: scale(1.1);

        &.show {
            pointer-events: auto;
            opacity: 1;
            transform: scale(1);
        }

        #settingForm {
            font-size: 10pt;
            line-height: 12pt;
        }
    }
    .checkbox-item {
        padding: 4px 0;

        label {
            position: relative;
            display: block;
        }

        svg {
            width: 10px;
            height: 10px;
            position: absolute;
            left: 3px;
            top: 3px;
            path {
                stroke-dasharray: 1000;
                stroke-dashoffset: 1000;
                stroke-width: 16px;
                stroke-linecap: round;
                stroke-linejoin: round;
                fill: none;
            }

            &.checked {
                path {
                    stroke-dasharray: 113.137, 113.137;
                    stroke-dashoffset: 0;
                    transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1) 0s;
                }
                path + path {
                    transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1) 280ms;
                }
            }
        }

        input[type='checkbox'] {
            appearance: none;
            width: 16px;
            height: 16px;
            margin-right: 2px;
            box-sizing: border-box;
            vertical-align: top;
            transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1) 0s;
        }
        input[type='checkbox']:focus {
            outline: none;
        }
    }

    #settingForm {
        input[type='range'] {
            appearance: none;
            -moz-appearance: none;
            -webkit-appearance: none;
            border-radius: 8px;
            width: 100%;
        }
        input[type='range']::-webkit-slider-runnable-track {
            height: 6px;
            border-radius: 10px;
            box-sizing: border-box;
        }
        input[type='range']:focus {
            outline: none;
        }
        input[type='range']::-webkit-slider-thumb {
            appearance: none;
            -moz-appearance: none;
            -webkit-appearance: none;
            height: 16px;
            width: 16px;
            margin-top: -6px;
            box-sizing: border-box;
            border-radius: 50%;
            transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
        }

        input[type='range']::-moz-range-track {
            height: 6px;
            border-radius: 10px;
            box-sizing: border-box;
        }
        input[type='range']::-moz-range-thumb {
            appearance: none;
            -moz-appearance: none;
            -webkit-appearance: none;
            height: 16px;
            width: 16px;
            margin-top: -6px;
            box-sizing: border-box;
            border-radius: 50%;
            transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
        }

        h3 {
            span {
                font-weight: 400;
                font-size: 20pt;
            }
        }
    }
    .image-level {
        margin: 0 4px;
    }
    .range-box {
        margin: 5px;
    }
    .range-label {
        display: flex;
        justify-content: space-between;
        a {
            flex: none;
            font-size: 10pt;
            width: 30px;
            text-align: center;
            display: inline-block;
        }
    }
}
